package com.wangshouyu.mp.micro.token;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.wangshouyu.mp.micro.base.response.BaseResponse;

import java.util.Objects;

/**
 * @author 王守钰
 * @date 2020年08月16日 00:58
 * @description: 微信小程序accessToken
 */
public class AccessToken extends BaseResponse {

    /**
     * AccessToken
     */
    @SerializedName(value = "access_token")
    @JsonProperty(value = "access_token")
    @JSONField(name = "access_token")
    private String accessToken;

    /**
     * 超时时间
     */
    @JsonProperty(value = "expires_in")
    @SerializedName(value = "expires_in")
    @JSONField(name = "expires_in")
    private Integer expiresIn;

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public Integer getExpiresIn() {
        return expiresIn;
    }

    public void setExpiresIn(Integer expiresIn) {
        this.expiresIn = expiresIn;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        AccessToken that = (AccessToken) o;
        return Objects.equals(accessToken, that.accessToken) && Objects.equals(expiresIn, that.expiresIn);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), accessToken, expiresIn);
    }

    @Override
    public String toString() {
        return "AccessToken{" +
                "accessToken='" + accessToken + '\'' +
                ", expiresIn=" + expiresIn +
                '}';
    }
}
